package com.chaike.hsq.properties;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.io.Serializable;

/**
 * 慧收钱配置文件.
 *
 * @author Luo
 * @version 1.0
 * @date 2021-12-31 10:51:00
 */
@Data
@ConfigurationProperties(prefix = HuiShouQianProperties.PREFIX)
public class HuiShouQianProperties {

    public static final String PREFIX = "huishouqian";

    /**
     * 是否启用服务注入.
     */
    private boolean enable;

    /**
     * 文件上传请求接口.
     */
    private String uploadUrl;

    /**
     * 代理商编号.
     * <pre>
     *     服务端分配商户编号
     * </pre>
     */
    private String agentMerchantNo;

    /**
     * 私钥证书文件路径.
     */
    private String pfxPath;

    /**
     * 公钥证书文件路径.
     */
    private String cerPath;

    /**
     * 私钥密码.
     */
    private String pfxPwd;

    /**
     * 商户请求配置.
     */
    private Merchant merchant;

    /**
     * 支付请求配置.
     */
    private Pay pay;

    /**
     * 商户进件配置.
     */
    @Data
    @Accessors(chain = true)
    public static class Merchant implements Serializable {

        private static final long serialVersionUID = -9219046786415162113L;

        /**
         * 接口请求地址.
         */
        private String apiUrl;

        /**
         * 版本号.
         * <pre>
         *     固定填写1.0.0
         * </pre>
         */
        private String version = "1.0.0";

        /**
         * 数据格式.
         * <pre>
         *     JSON/XML
         * </pre>
         */
        private String format = "JSON";

        /**
         * 加密类型.
         * <pre>
         *     RSA/CFCA
         * </pre>
         */
        private String signType = "CFCA";

    }

    /**
     * 支付配置.
     */
    @Data
    @Accessors(chain = true)
    public static class Pay implements Serializable {

        private static final long serialVersionUID = -7957123080697923135L;

        /**
         * 接口请求地址.
         */
        private String apiUrl;

        /**
         * 版本号.
         * <pre>
         *     固定填写1.0
         * </pre>
         */
        private String version = "1.0";

        /**
         * 数据格式.
         * <pre>
         *     JSON/XML
         * </pre>
         */
        private String format = "JSON";

        /**
         * 加密类型.
         * <pre>
         *     CFCA
         * </pre>
         */
        private String signType = "CFCA";

    }

}


